package fr.emn.nuitinfo.web;

import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.routing.Router;

import fr.emn.nuitinfo.web.resources.ChasseResource;
import fr.emn.nuitinfo.web.resources.ChassesResource;
import fr.emn.nuitinfo.web.resources.CoordonneeResource;
import fr.emn.nuitinfo.web.resources.CoordonneesResource;
import fr.emn.nuitinfo.web.resources.DureeResource;
import fr.emn.nuitinfo.web.resources.DureesResource;
import fr.emn.nuitinfo.web.resources.EtapeResource;
import fr.emn.nuitinfo.web.resources.EtapeValidationResource;
import fr.emn.nuitinfo.web.resources.EtapesResource;
import fr.emn.nuitinfo.web.resources.EvaluationResource;
import fr.emn.nuitinfo.web.resources.EvaluationsResource;
import fr.emn.nuitinfo.web.resources.LieuResource;
import fr.emn.nuitinfo.web.resources.LieuxResource;
import fr.emn.nuitinfo.web.resources.ParticipationResource;
import fr.emn.nuitinfo.web.resources.ParticipationsResource;
import fr.emn.nuitinfo.web.resources.UtilisateurResource;
import fr.emn.nuitinfo.web.resources.UtilisateursResource;

public class ChasseApplication extends Application {

	/**
	 * Creates a root Restlet that will receive all incoming calls.
	 */
	@Override
	public Restlet createInboundRoot() {
		// Routeur de base
		Router router = new Router(getContext());

		// Definition des collections
		router.attach("/chasses", ChassesResource.class);
		router.attach("/coordonnees", CoordonneesResource.class);
		router.attach("/durees", DureesResource.class);
		router.attach("/etapes", EtapesResource.class);
		router.attach("/evaluations", EvaluationsResource.class);
		router.attach("/lieux", LieuxResource.class);
		router.attach("/participations", ParticipationsResource.class);
		router.attach("/utilisateurs", UtilisateursResource.class);

		// Definition des elements
		router.attach("/chasses/{nom}", ChasseResource.class);
		router.attach("/coordonnees/{nom}", CoordonneeResource.class);
		router.attach("/durees/{nom}", DureeResource.class);
		router.attach("/etapes/{nom}", EtapeResource.class);
		router.attach("/etapes/{nom}/valider", EtapeValidationResource.class);
		router.attach("/evaluations/{nom}", EvaluationResource.class);
		router.attach("/lieux/{nom}", LieuResource.class);
		router.attach("/participations/{nom}", ParticipationResource.class);
		router.attach("/utilisateurs/{nom}", UtilisateurResource.class);

		return router;
	}
}
